package beanUtils;

import java.util.Map;
import java.lang.reflect.InvocationTargetException;
import java.lang.IllegalAccessException;
import org.apache.commons.beanutils.BeanUtils;
import javax.servlet.http.*;

public class BeanUtility {
	public static void populateBean(Object bean, HttpServletRequest req) {
		populateBean(bean, req.getParameterMap());
		
	}

	public static void populateBean(Object bean, Map propertyMap) {
		try {
			BeanUtils.populate(bean, propertyMap);
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e1) {
			e1.printStackTrace();
		}
	}
}
